from typing import List, Dict
from aiohttp import web

{{#imports}}{{import}}
{{/imports}}
from {{packageName}} import util
{{#operations}}
{{#operation}}


async def {{operationId}}(request: web.Request, {{#allParams}}{{paramName}}{{^required}}=None{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> web.Response:
    """{{#summary}}{{.}}{{/summary}}{{^summary}}{{operationId}}{{/summary}}

    {{#notes}}{{.}}{{/notes}}

    {{#allParams}}
    :param {{paramName}}: {{description}}
        {{^isContainer}}
            {{#isPrimitiveType}}
    :type {{paramName}}: {{>param_type}}
            {{/isPrimitiveType}}
            {{#isUuid}}
    :type {{paramName}}: {{>param_type}}
            {{/isUuid}}
            {{^isPrimitiveType}}
                {{#isFile}}
    :type {{paramName}}: werkzeug.datastructures.FileStorage
                {{/isFile}}
                {{^isFile}}
                    {{^isUuid}}
    :type {{paramName}}: dict | bytes
                    {{/isUuid}}
                {{/isFile}}
            {{/isPrimitiveType}}
        {{/isContainer}}
        {{#isListContainer}}
            {{#items}}
                {{#isPrimitiveType}}
    :type {{paramName}}: List[{{>param_type}}]
                {{/isPrimitiveType}}
                {{^isPrimitiveType}}
    :type {{paramName}}: list | bytes
                {{/isPrimitiveType}}
            {{/items}}
        {{/isListContainer}}
        {{#isMapContainer}}
            {{#items}}
                {{#isPrimitiveType}}
    :type {{paramName}}: Dict[str, {{>param_type}}]
                {{/isPrimitiveType}}
                {{^isPrimitiveType}}
    :type {{paramName}}: dict | bytes
                {{/isPrimitiveType}}
            {{/items}}
        {{/isMapContainer}}
    {{/allParams}}

    """
    {{#allParams}}
        {{^isContainer}}
            {{#isDate}}
    {{paramName}} = util.deserialize_date({{paramName}})
            {{/isDate}}
            {{#isDateTime}}
    {{paramName}} = util.deserialize_datetime({{paramName}})
            {{/isDateTime}}
            {{^isPrimitiveType}}
                {{^isFile}}
                    {{^isUuid}}
    {{paramName}} = {{baseType}}.from_dict({{paramName}})
                    {{/isUuid}}
                {{/isFile}}
            {{/isPrimitiveType}}
        {{/isContainer}}
        {{#isListContainer}}
            {{#items}}
                {{#isDate}}
    {{paramName}} = [util.deserialize_date(s) for s in {{paramName}}]
                {{/isDate}}
                {{#isDateTime}}
    {{paramName}} = [util.deserialize_datetime(s) for s in {{paramName}}]
                {{/isDateTime}}
                {{#complexType}}
    {{paramName}} = [{{complexType}}.from_dict(d) for d in {{paramName}}]
                {{/complexType}}
            {{/items}}
        {{/isListContainer}}
        {{#isMapContainer}}
            {{#items}}
                {{#isDate}}
    {{paramName}} = {k: util.deserialize_date(v) for k, v in {{paramName}}}
                {{/isDate}}
                {{#isDateTime}}
    {{paramName}} = {k: util.deserialize_datetime(v) for k, v in {{paramName}}}
                {{/isDateTime}}
                {{#complexType}}
    {{paramName}} = {k: {{baseType}}.from_dict(v) for k, v in {{paramName}}}
                {{/complexType}}
            {{/items}}
        {{/isMapContainer}}
    {{/allParams}}
    return web.Response(status=200)
{{/operation}}
{{/operations}}
